1. Field of the Invention
The present invention pertains to the field of processor architecture. More particularly, this invention relates to selectively controlling groups of registers in a processor.
2. Background
Modern computer systems frequently execute multiple software programs concurrently, a feature commonly referred to as multi-tasking. Each instance of an application being executed is commonly referred to as a "task". In order to multi-task on a computer system having a single processor, the various tasks share the single processor. Typically, the processor executes instructions from a particular task for a period of time, often referred to as a time slice, and then switches tasks to begin executing instructions from a second task during a second time slice. This switching of tasks is commonly referred to as a "context switch".
One feature found in most processors is a register set. The register set typically comprises multiple registers that store various control information related to the tasks being executed. Additionally, the register set also typically contains multiple data registers that can be accessed by programmers in order to save data.
In a multi-tasking computer system, it is necessary to save at least some of the registers in the register set during a context switch because there is typically only one register set for all tasks to use, regardless of how many tasks are being multi-tasked. For example, if two tasks are being executed by a processor, then the task-specific control information and data must be maintained by the processor for each of the tasks. Typically, all of the registers are saved to memory when a context switch occurs and the contents of the registers for the task that is about to begin execution by the processor are restored to the register set from memory. These contents would typically be the contents that were saved the last time the processor stopped executing the task in order to switch to a different task. This saving and restoring of register contents is typically referred to as "swapping".
However, saving and restoring the entire contents of the register set during a context switch may not always be necessary. For example, a newly executing task may access but not modify a particular group of registers during the time period it is executing. Therefore, it is not necessary for the group of registers to be re-saved during the next context switch. The unnecessary saving of the states of the groups of the register set results in a wasted delay, which is increased as register sets grow larger and larger. Thus, it would be beneficial to provide a way to reduce the amount of unnecessary register saving which occurs during a context switch.
As will be described in more detail below, the present invention provides a method and apparatus for selectively controlling groups of registers to achieve these and other desired results which will be apparent to those skilled in the art from the description that follows.